//
//  LXDataManager.h
//  LvXi_newVersion
//
//  Created by 王敏 on 16/8/15.
//  Copyright © 2016年 SJT. All rights reserved.
//


#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>

typedef NS_ENUM(NSUInteger, OrderPayment) {
    OrderPaymentPreparPay = 0,
    OrderPaymentAll = -1,
    OrderPaymentPreparGetgoods = 1,
};
@interface LXDataManager : NSObject

+(instancetype)manager;


/***********coreData分割线开始***********/

@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;

- (void)saveContext;
- (NSURL *)applicationDocumentsDirectory;
/***********coreData分割线结束***********/
/**
 *  用户注册
 *
 *  @param prame    注册参数
 *  @param complete 完成回调
 */
-(void)userRegisterWithPrama:(NSDictionary*)prame complete:(void(^)(BOOL success,id res))complete;


/**
 *  用户登录
 *
 *  @param prama    登录参数
 *  @param complete 完成回调
 */
-(void)userLoginWithPrama:(NSDictionary*)prama complete:(void(^)(BOOL success,id res))complete;

/**
 *  第三方注册
 *
 *  @param prama    注册参数
 *  @param complete 完成回调
 */
-(void)userSocialRegister:(NSDictionary*)prama complete:(void(^)(BOOL success,id res))complete;

/**
 *  第三方登录
 *
 *  @param prama    登录参数
 *  @param complete 完成回调
 */
-(void)userSocialLogin:(NSDictionary*)prama complete:(void(^)(BOOL success,id res))complete;

/**
 *  保存收货地址
 *
 *  @param dict 收货地址信息
 */
-(void)saveReceptAddress:(NSDictionary*)dict;
-(NSArray*)allAddress;


/**
 *  获取首页banner
 *
 *  @param complete 完成回调
 */
-(void)getBannerWithComplete:(void(^)(BOOL success,id res))complete;

/**
 *  下载banner图片
 *
 *  @param complete 完成
 */
-(void)getBannerImageWithAds:(NSArray*)ads complele:(void(^)(BOOL success,id res))complete;

/**
 *  获取限时抢购数据
 *
 *  @param complete 完成回调
 */
-(void)getFlashSaleWithComplete:(void(^)(BOOL success,id res))complete;

/**
 *  获取爱生活数据
 *
 *  @param complete 完成回调
 */
-(void)getIndexfloorWithComplete:(void(^)(BOOL success,id res))complete;

/**
 *  根据商品id获取商品规格详情
 *
 *  @param product_id 商品id
 *  @param complete   完成回调
 */
-(void)getSpecWithProductID:(NSString*)product_id complete:(void(^)(BOOL success,id res))complete;


/**
 *  根据商品id获取商品图片详情
 *
 *  @param product_id product_id 商品id
 *  @param complete   complete   完成回调
 */
-(void)getProductDetailWithProduct_id:(NSString*)product_id complete:(void(^)(BOOL success,id res))complete;

/**
 *  获取分类
 *
 *  @param complete 完成回调
 */
-(void)getCategoryWithComplete:(void(^)(BOOL success,id res))complete;


/**
 *  根据分类id获取商品列表
 *
 *  @param cat_id   分类id
 *  @param complete 完成回调
 */
-(void)getProductsWithCatt_id:(NSString*)cat_id complete :(void(^)(BOOL success,id res))complete;

/**
 *  获取商品列表
 *  参数:
 *      cat_id      分类id 必须
 *      brand_id    品牌id 必须有？
 *      sort        筛选类型 :1表示接价格高到低
 *                           2价格由低到高
 *                           3佣金低到高
 *                           4表示拥金由高到低
 *                           5发布时间后到先
 *                           6发布时间先到后
 *
 *  @param prama    参数
 *  @param complete 完成回调
 */
-(void)getProductWithPrama:(NSDictionary*)prama complete :(void(^)(BOOL success,id res))complete;

/**
 *  搜索
 *
 *  @param keyword  关键字
 *  @param complete 完成回调
 */
-(void)getProductsWithKeyword:(NSString *)keyword complete :(void(^)(BOOL success,id res))complete;

/**
 *  获取商品列表
 *
 *  @param url      链接
 *  @param complete 完成回调
 */
-(void)getProductsWithUrl:(NSString*)url complete :(void(^)(BOOL success,id res))complete;


/**
 *  获取短信验证码
 *
 *  @param phone    手机号
 *  @param complete 完成回调
 */
-(void)getsmsCodeWithPhone:(NSString*)phone complete:(void(^)(BOOL success,id res))complete;


/**
 *  上传头像
 *
 *  @param image    图片
 *  @param uid      用户id
 *  @param complete 完成回调
 */
-(void)upLoadHeaderImage:(UIImage*)image uid:(NSString*)uid complete:(void(^)(BOOL success,id res))complete;

/**
 *  添加商品到购物车
 *
 *  @param product  商品
 *  @param complete 完成回调
 */
-(void)addShopCartWithProduct:(Product*)product complete:(void(^)(BOOL success,id res))complete;

/**
 *  购物车商品数 -1
 *
 *  @param product  商品
 *  @param complete 完成回调
 */
-(void)delShopCartWithProduct:(Product*)product complete:(void(^)(BOOL success,id res))complete;

/**
 *  从购物车删除商品
 *
 *  @param product  商品
 *  @param complete 完成回调
 */-(void)delAllShopCartWithProduct:(Product *)product complete:(void (^)(BOOL, id))complete;

/**
 *  获取购物车列表
 *
 *  @param complete 完成回调
 */
-(void)getShopCartListComplete:(void(^)(BOOL success,id res))complete;


/**
 *  添加收货地址
 *  参数:
 *       user_id 	 string 	Yes 	用户唯一标识
 *       name        string 	Yes 	收货人
 *       mobile      string 	Yes 	收货人手机号
 *       def_addr 	 string 	Yes 	默认地址,1是默认，0是不默认
 *       province 	 string 	Yes 	省
 *       city        string 	Yes 	市
 *       district 	 string 	Yes 	区/县
 *       addr        string 	Yes 	详细地址
 *  @param prama    参数
 *  @param complete 完成回调
 */
-(void)addAddressWith:(AddressModel*)address complete:(void (^)(BOOL, id))complete;

-(void)getAddrListWithComplete:(void(^)(BOOL success,id res))complete;

-(void)delAddress:(AddressModel*)address complete:(void(^)(BOOL success,id res))complete;

/**
 *  获取订单号
 *
 *  @param prama    订单参数
 *  @param complete 完成回调
 */
-(void)getOrderIDWithPrama:(NSDictionary*)prama complete:(void(^)(BOOL success,id res))complete;


/**
 *  获取优惠券
 *
 *  @param word     关键字
 *  @param complete 完成回调
 */
-(void)getCouponWithKeyWord:(NSString*)word complete:(void(^)(BOOL success,id res))complete;

/**
 *  获取用户绿豆信息
 *
 *  @param complete 完成回调
 */
-(void)getGreenBeanWithComplete:(void(^)(BOOL success,id res))complete;

/**
 *  获取用户信息
 *
 *  @param complete 完成回调
 */
-(void)getUserInfoWithComplete:(void(^)(BOOL success,id res))complete;

/**
 *  获取用户绿豆书
 *
 *  @param prama    用户参数
 *  @param complete 完成回调
 */
-(void)getGreenBeansCountWithPrama:(NSDictionary*)prama complete:(void(^)(BOOL success,id res))complete;

/**
 *  用户签到
 *
 *  @param prama    签到参数
 *  @param complete 完成回调
 */
-(void)userSignWithPrama:(NSDictionary*)prama complete:(void(^)(BOOL success,id res))complete;

/**
 *  获得签到天数
 *
 *  @param prama    签到参数
 *  @param complete 完成回调
 */
-(void)getSignDaysWithPrama:(NSDictionary*)prama complete:(void(^)(BOOL success,id res))complete;

/**
 *  获取订单列表
 *
 *  @param payment  订单状态
 *  @param complete 完成回到
 */
-(void)getOrderListWithPaynent:(OrderPayment)payment complete:(void(^)(BOOL success,id res))complete;

/**
 *  获取绿豆明细
 *
 *  @param complete 完成回调
 */
-(void)getGreenBeanDetailWithComplete:(void(^)(BOOL success,id res))complete;

/**
 *  获取优惠券列表
 *
 *  @param complete 完成回调
 */
-(void)getCouponListWithComplete:(void(^)(BOOL success,id res))complete;


/**
 *  添加关注
 *
 *  @param product  商品
 *  @param complete 完成回调
 */
-(void)addFocusProduct:(Product*)product complete:(void(^)(BOOL success,id res))complete;

/**
 *  移除关注
 *
 *  @param product  商品
 *  @param complete 完成回调
 */
-(void)delFocusProduct:(Product*)product complete:(void(^)(BOOL success,id res))complete;


/**
 *  关注列表
 *
 *  @param complete 完成回调
 */
-(void)listFocusProductWithComplete:(void(^)(BOOL success,id res))complete;



-(void)getArticleListWithComplete:(void(^)(BOOL success,id res))complete;


/**
 *  更新订单状态
 *
 *  @param prama    参数
 *  @param complete 完成回调
 */
-(void)upDataOrderStatuWithPrama:(NSDictionary*)prama complete:(void(^)(BOOL success,id res))complete;

/**
 *  更新用户信息
 *
 *  @param prama    参数
 *  @param complete 完成回调
 */

-(void)upDateUserInfoWithPrama:(NSDictionary*)prama complete:(void(^)(BOOL success,id res))complete;




/**
 *  忘记密码
 *
 *  @param prama    参数
 *  @param complete 完成回调
 */

-(void)forgetPasswordWithPrama:(NSDictionary*)prama complete:(void(^)(BOOL success,id res))complete;



-(void)getAliPayInfoWithPrama:(NSDictionary*)prama Complete:(void(^)(BOOL success,id res))complete;
@end
